if (!jsx3.lang.Class.forName("ux.cdb.admin.system.parameter.Parameter")) {

	/**
	 * Define the <code>ux.cdb.admin.system.parameter.Parameter</code> class.
	 * This class inherit from <code>jsx3.gui.Block<code> GUI class.
	 */
	jsx3.Class.defineClass("ux.cdb.admin.system.parameter.Parameter", ux.megatron.gui.Block, null, function(objRoot){
		
		/**
		 * The static field of matrix CDF data.
		 */
		objRoot.MTX_MANAGE_CDFDATA_ORIGINAL = "mtxManageCDFDataOriginal";
		objRoot.MTX_MANAGE_CDFDATA_PROCESS = "mtxManageCDFDataProcess";
		
		objRoot.MTX_CATEGORY_NAME = "mtxCategory";
		objRoot.MTX_MANAGE_NAME = "mtxManage";
		
		objRoot.EVENTS = {
			NONE:'None',
			NEW: 'New',
			MODIFY: 'Modify',
			REMOVE: 'Remove',
			SAVE: 'Save',
			CANCEL: 'Cancel',
			CATEGORY: {
				OPERATION_MODE:'OperationMode', 
				PARAMETERS:'Parameters',
				PARAM_A:'ParamA',
				PARAM_B:'ParamB',
				PARAM_C:'ParamC',
				DEFAULT:'Default'
			}
		};
		
		/**
		 * Helper Functions, return a copy function with 
		 * @param fn {Function}
		 * @param scope {Object} 
		 */
		objRoot.prototype.bind = function(fn, scope) {
			scope = scope || this;
			return function() {
				fn.apply(scope, arguments);
			};
		};
		
		/**
		 * Add event to jsx Object
		 * @param name {String} jsx object name or comma-splitted names
		 * @param event {String} event name
		 * @param fct {Function} event handler
		 */
		objRoot.prototype.on = function (name, event, fct) {
			var names = name.split(","), block=this;
			for(var i=0; i<names.length; i++) {
				block = block.get(names[i]);
			}
			block[event] = this.bind(fct);
		};

		/**
		 * This method will be called after UI file has deserialized.
		 */
		objRoot.prototype.onAfterDeserialize = function(){
		};
		
		objRoot.prototype.initialize = function(){
			var me = this;
			this.btnEvent = {name:objRoot.EVENTS.NONE};
			this.mtxEvent = {name:objRoot.EVENTS.CATEGORY.DEFAULT};
			
			this.editMode = false;
			
			/**
			 * while click 'Save' button, this field will be 'true'.(e.g. when click 'New' button, change this mode 'false')
			 */
			this.cacheMode = true;
			
			/**
			 * matrix data cache.
			 */
			this.dataCache = [];
			
			this._mtxCategory = this.get(objRoot.MTX_CATEGORY_NAME);
			this._mtxManage = this.get(objRoot.MTX_MANAGE_NAME);
			this._btnModify = this.get('btnModify');
			this._ctlLabel = this.get("ctlLabel");
			
			this.panelOperationMode = this.get('panelOperationMode');
			this.panelParameters = this.get('panelParameters');
			
			setTimeout(function(){
				me._ctlLabel.hide();
				me._mtxManage.setCanDrag(false);
				me._mtxManage.setCanDrop(false);
				me._resetMtxManage();
				me.setEnabledState([
						[/*Modify*/me._btnModify, true], 
						[/*Save*/me._ctlLabel.getChild(0), false], 
						[/*Cancel*/me._ctlLabel.getChild(1), false]
				]);

				me._btnModify.onClick = me.bind(me.onModifyClicked);
				me._ctlLabel.getChild(0).onClick = me.bind(me.onSaveClicked);
				me._ctlLabel.getChild(1).onClick = me.bind(me.onCancelClicked);
				me.mcOperationMode = me.get('mcOperationMode');
				me.mcParameterTitle = me.get('mcParameterTitle');
				me.mcParameterValue = me.get('mcParameterValue');
			},10);
			
			//modify parameters by panel
			this.selectBoxs = this.panelParameters.getDescendantsOfType(jsx3.gui.Select);
			setTimeout(function(){
				ux.megatron.Main.loadResource("ux/cdb/admin/system/parameter/docs/month.xml", "ux.cdb.admin", "Parameters_Source_Month_0101", "xml");
				ux.megatron.Main.loadResource("ux/cdb/admin/system/parameter/docs/day.xml", "ux.cdb.admin", "Parameters_Source_Day_0102", "xml");
				/* this.selectBoxs[0].setSourceXML(monthCDF);
				this.selectBoxs[2].setSourceXML(monthCDF);
				this.selectBoxs[3].setSourceXML(monthCDF);
				this.selectBoxs[1].setSourceXML(dayCDF);
				this.selectBoxs[4].setSourceXML(dayCDF); */
			},10);
/* @JSC :: begin DEBUG */
			jsx3.log('initialize end.');
/* @JSC :: end */
		};
		
		objRoot.prototype.getProperty = function(name, token) {
			return ux.megatron.Main.getServer().getDynamicProperty(name, token);
		};
		
		objRoot.prototype.getEditMode = function(btnObj,objEVENT,strRECORDID,objCOLUMN){
			if(this.editMode === true){
				if(objCOLUMN.getName() !== 'mcParameterValue')
					return false;
			}
			return this.editMode;
		};
		
		objRoot.prototype.setEditMode = function(mode){
			//if(this.btnEvent.name == objRoot.EVENTS.CATEGORY.OPERATION_MODE)
			//	return;
			this.editMode = (mode === true ? true : false);
		};
		
		/**
		 * e.g: this.getAncestorOfType("ux.cdb.admin.system.parameter.Parameter").onModifyClicked(this, objEVENT);
		 */		
		objRoot.prototype.onModifyClicked = function(objBtn, objEVENT){
			var _self = this;
			this.btnEvent.name = objRoot.EVENTS.MODIFY;
			this._btnModify.hide();
			setTimeout(function(){_self._ctlLabel.fadeIn();},100);
			this.setEnabledState([
					[/*Modify*/this._btnModify, false], 
					[/*Save*/this._ctlLabel.getChild(0), true], 
					[/*Cancel*/this._ctlLabel.getChild(1), true]
			]);
			
			if(this.mtxEvent.name === objRoot.EVENTS.CATEGORY.OPERATION_MODE){
				this.dataCache[objRoot.MTX_MANAGE_CDFDATA_ORIGINAL] = this._mtxManage.getXML().cloneDocument();
				this._mtxManage.setCanDrag(true);
				this._mtxManage.setCanDrop(true);
			}else{
				this.setEditMode(true);
				if (this._mtxManage.getSelectedIds().length > 0) {
					this._mtxManage.focusCellById(this._mtxManage.getSelectedIds()[0], "jsxtext");
				}
				this._resetSelectBox();
			}

/* @JSC :: begin DEBUG */
			jsx3.log("Original CDF:[type:" + typeof(this.dataCache[objRoot.MTX_MANAGE_CDFDATA_ORIGINAL]) + "] " + this.dataCache[objRoot.MTX_MANAGE_CDFDATA_ORIGINAL]);
			jsx3.log("Edit clicked.");
/* @JSC :: end */
		};

		objRoot.prototype.onSaveClicked = function(objBtn, objEVENT){
			var _self = this;
			this.cacheMode = true;
			this.btnEvent.name = objRoot.EVENTS.NONE;
			this.setEditMode(false);
			_self.dataCache[objRoot.MTX_MANAGE_CDFDATA_PROCESS] = _self._mtxManage.getXML().cloneDocument(); //cache current CDF.
			var cdfObj = ux.megatron.util.JSON.CDFtoJSON(_self.dataCache[objRoot.MTX_MANAGE_CDFDATA_PROCESS]);
			var objList = [];
			var InternalOrgRetailStudentLoanModeUIO = {
				loanModeList : [],
				notLoanModeList : [],
				otherModeList : []
			};
/* @JSC :: begin DEBUG */
			jsx3.log('cdf to object : ' + dwr.util.toDescriptiveString(cdfObj, 6));
/* @JSC :: end */
			var isOperationMode = _self.mtxEvent.name === objRoot.EVENTS.CATEGORY.OPERATION_MODE;
			if(isOperationMode){
				for(var i = 0,item; item = cdfObj.record[i]; i++){
					if(item.record){
						if(item.jsxid == '1'){
/* @JSC :: begin DEBUG */
							jsx3.log('item.record : ' + dwr.util.toDescriptiveString(item.record, 4) + ' | isArray:' + (item.record instanceof Array));
/* @JSC :: end */
							if(item.record instanceof Array)
								for(var ia = 0,itemA; itemA = item.record[ia]; ia++)
									InternalOrgRetailStudentLoanModeUIO.loanModeList.push({internalOrgId:itemA.internalOrgId, orgName:itemA.orgName});
						}else if(item.jsxid == '2'){
							if(item.record instanceof Array)
								for(var ib = 0,itemB; itemB = item.record[ib]; ib++)
									InternalOrgRetailStudentLoanModeUIO.notLoanModeList.push({internalOrgId:itemB.internalOrgId, orgName:itemB.orgName});
						}else if(item.jsxid == '3'){
							if(item.record instanceof Array)
								for(var ic = 0,itemC; itemC = item.record[ic]; ic++)
									InternalOrgRetailStudentLoanModeUIO.otherModeList.push({internalOrgId:itemC.internalOrgId, orgName:itemC.orgName});
						}
					}else{
						objList.push(item);
					}
				}
			}else{
				if(this.selectBoxs && this.selectBoxs instanceof Array){
					var paramA = this.selectBoxs[0].getValue() + '_' + this.selectBoxs[1].getValue();
					var paramB = this.selectBoxs[2].getValue() + '';
					var paramC = this.selectBoxs[3].getValue() + '_' + this.selectBoxs[4].getValue();
					objList.push({paramValue : paramA});
					objList.push({paramValue : paramB});
					objList.push({paramValue : paramC});
				}
				this._resetSelectBox();
			}
			var doFunction = isOperationMode ? "updateInternalOrgRetailStudentLoanMode" : "updateAllParameter";
			var param = isOperationMode ? InternalOrgRetailStudentLoanModeUIO : objList;
/* @JSC :: begin DEBUG */
			jsx3.log('param to object : ' + dwr.util.toDescriptiveString(param, 3));
			jsx3.log('doFunction : ' + doFunction + ' | param : ' + param);
/* @JSC :: end */
			ux.megatron.util.Dwr.callDwr("RetailStudentLoanParameterManagementUCC",doFunction,[param],this,
				function(data){
					if (data != null && typeof data == 'object') {
/* @JSC :: begin DEBUG */
						jsx3.log('Parameter#onSaveClicked return data:' + dwr.util.toDescriptiveString(data, 4));
/* @JSC :: end */
						ux.megatron.Dialog.alert(this.getProperty("@cdb@System@Parameter@dlgAlertTitle"), 
							(data.res.flag == '1') ? this.getProperty("@cdb@System@Parameter@dlgAlertMessage#SaveSuccess") : 
							this.getProperty("@cdb@System@Parameter@dlgAlertMessage#SaveFailed"), 
							function(objDialog){
								objDialog.doClose();
								_self._mtxManage.setCanDrag(false);
								_self._mtxManage.setCanDrop(false);
								_self._btnModify.show();
								_self._btnModify.enable();
								_self.setEnabledState([
										[/*Modify*/_self._btnModify, true], 
										[/*Save*/_self._ctlLabel.getChild(0), false], 
										[/*Cancel*/_self._ctlLabel.getChild(1), false]
								]);
								_self._ctlLabel.fadeOut();
							});
					}
				});
/* @JSC :: begin DEBUG */
			jsx3.log("Save clicked. current CDF:" + this.dataCache[objRoot.MTX_MANAGE_CDFDATA_PROCESS]);
/* @JSC :: end */
		};
		
		objRoot.prototype.onCancelClicked = function(objBtn, objEVENT){
			var _self = this;
			var _doCancel = function(objDialog){
				_self.btnEvent.name = objRoot.EVENTS.NONE;
				_self.editMode = false;
				_self.cacheMode = true;
				
				if(this.mtxEvent.name === objRoot.EVENTS.CATEGORY.OPERATION_MODE){
					_self._mtxManage.setCanDrag(false);
					_self._mtxManage.setCanDrop(false);
/* @JSC :: begin DEBUG */
					jsx3.log("OriginalCDF:[type:" + typeof(_self.dataCache[objRoot.MTX_MANAGE_CDFDATA_ORIGINAL]) + "] " + _self.dataCache[objRoot.MTX_MANAGE_CDFDATA_ORIGINAL]);
/* @JSC :: end */
					_self._mtxManage.setSourceXML(_self.dataCache[objRoot.MTX_MANAGE_CDFDATA_ORIGINAL]);
					
/* @JSC :: begin DEBUG */
					jsx3.log("CurrentCDF after set: " + _self._mtxManage.getXML().toString());
/* @JSC :: end */
					_self._mtxManage.repaintData();
				} else {
					_self._resetSelectBox();
				}

				this._ctlLabel.fadeOut(function(){
					_self._btnModify.show();
					_self._btnModify.enable();
					_self.setEnabledState([
						[/*Modify*/_self._btnModify, true], 
						[/*Save*/_self._ctlLabel.getChild(0), false], 
						[/*Cancel*/_self._ctlLabel.getChild(1), false]
					]);
				});
				
/* @JSC :: begin DEBUG */
				jsx3.log("_doCancel.");
/* @JSC :: end */
			};
			if (_self.btnEvent.name == objRoot.EVENTS.NEW) {
				var _c = ux.megatron.Dialog.confirm(this.getProperty("@cdb@System@Parameter@dlgConfirmTitle"), 
													this.getProperty("@cdb@System@Parameter@dlgConfirmMessage#DropRecord"), 
				function(objDialog){
					objDialog.doClose();
					_doCancel.call(_self, objDialog);
				});
/* @JSC :: begin DEBUG */
				jsx3.log("Dialog confirm : " + _c);
/* @JSC :: end */
			}else{
				_doCancel.call(this);
			}
/* @JSC :: begin DEBUG */
			jsx3.log("Cancel clicked.");
/* @JSC :: end */
		};

		objRoot.prototype._setMatrixToggle = function(flag){
			var _flag = flag === false ? 1 : 0;
/* @JSC :: begin DEBUG */
			jsx3.log('Parameter#_setMatrixToggle flag : ' + _flag);
/* @JSC :: end */
			var parents = this._mtxManage.getXML().selectNodes('//record[@jsxopen=' + _flag + ']');
			//jsx3.log('Parameter#_setMatrixToggle parents ['+parents.size()+']: ' + this._mtxManage.getXML());
			var it = parents.iterator();
			while(parents.hasNext()){
				var _node = parents.next();
				this._mtxManage.toggleItem(_node.getAttribute('jsxid'), flag);
				_node.setAttribute('jsxopen', (flag == false ? 0 : 1));
			}
		};
		
		objRoot.prototype.onManageDrag = function(objBtn, objEVENT, strDRAGID){
/* @JSC :: begin DEBUG */
			jsx3.log('Parameter#onManageDrag begin... recordID:' + strDRAGID);
/* @JSC :: end */
			if(!strDRAGID) return false;
			var record = this._mtxManage.getRecordNode(strDRAGID);
			if(record.getParent().getAttribute('jsxid') === 'jsxroot') 
				return false;
			this._setMatrixToggle(false);
		};
		
		objRoot.prototype.onManageBeforeDrop = function(obj, objEVENT, strRECORDID, strDRAGTYPE){
			if(!strRECORDID) return false;
			var record = this._mtxManage.getRecordNode(strRECORDID);
			if(record.getAttribute('jsxid') === 'jsxroot' ||
			   record.getParent().getAttribute('jsxid') !== 'jsxroot')
				return false;
		};
		
		objRoot.prototype.onManageDrop = function(objBtn, objEVENT, strDRAGID, strRECORDID, bINSERTBEFORE){
			this._setMatrixToggle(true);
			if(!strRECORDID) return false;
			var record = this._mtxManage.getRecordNode(strRECORDID);
			//this._mtxManage.focusCellById(strDRAGID);
			this._mtxManage.focusRowById(strDRAGID);
			this._mtxManage.selectRecord(strDRAGID);
/* @JSC :: begin DEBUG */
			jsx3.log('onManageDrop target : ' + record.getAttribute('jsxid'));
/* @JSC :: end */
			if(record.getParent().getAttribute('jsxid') === 'jsxroot' && !bINSERTBEFORE){
				return true;
			}else 
				return false;
		};
		
		objRoot.prototype.currentCategoryRecordID = null;
		
		objRoot.prototype.onCategoryChange = function(objBtn, objEVENT){
			if(!this.currentCategoryRecordID || this.btnEvent.name !== objRoot.EVENTS.MODIFY) return;
			this._mtxCategory.focusRowById(this.currentCategoryRecordID);
			this._mtxCategory.selectRecord(this.currentCategoryRecordID);
		};
		
		/**
		* category manager
		*/
		objRoot.prototype.onCategorySelected = function(objBtn, objEVENT, strRECORDID){
			if(!strRECORDID || (this.btnEvent.name === objRoot.EVENTS.MODIFY)) return;
			this.currentCategoryRecordID = strRECORDID;
			this._resetMtxManage();
			switch(strRECORDID){
				case '1' :
				case '11' :
					this.mtxEvent.name = objRoot.EVENTS.CATEGORY.OPERATION_MODE;
					this._loadOperationMode();
					break;
				case '2' :
					this.mtxEvent.name = objRoot.EVENTS.CATEGORY.PARAMETERS;
					this._loadParameters();
					break;
				default :
					this.mtxEvent.name = objRoot.EVENTS.CATEGORY.DEFAULT;
/* @JSC :: begin DEBUG */
					jsx3.log('root id can not be actived.');
/* @JSC :: end */
			}
/* @JSC :: begin DEBUG */
			jsx3.log("onCategorySelected[" + strRECORDID + "] clicked.");
/* @JSC :: end */
		};
		
		objRoot.prototype._resetMtxManage = function(){
			if(this.mtxEvent.name === objRoot.EVENTS.CATEGORY.PARAMETERS){
				this.panelOperationMode.show();
				this.panelParameters.hide();
			}
			this._mtxManage.clearXmlData();
			this._mtxManage.repaintData();
		};
		
		objRoot.prototype._resetSelectBox = function(){
			if(this.selectBoxs && this.selectBoxs instanceof Array){
				var _array = [];
				for(var i=0,item;item = this.selectBoxs[i];i++){
					_array.push([item, this.editMode]);
				}
				this.setEnabledState(_array);
			}
		};
		
		objRoot.prototype._convertMode = function(data) {
/* @JSC :: begin DEBUG */
			jsx3.log('Parameter#_convertMode CDF:' + dwr.util.toDescriptiveString(data, 4));
/* @JSC :: end */
			if(!data) 
				throw new jsx3.lang.IllegalArgumentException('parameters required!', 'data : ' + data);
			var cdf = jsx3.xml.CDF.Document.newDocument();
			var mode = [['1',this.getProperty('@cdb@System@Parameter@Parameters_Mode')],
						['2',this.getProperty('@cdb@System@Parameter@Parameters_Modeless')],
						['3',this.getProperty('@cdb@System@Parameter@Parameters_Others')]];
/* @JSC :: begin DEBUG */
			jsx3.log('Parameter#_convertMode mode: ' + mode.toString());
/* @JSC :: end */
			try{
				for(var i = 0, item; item = data[i]; i++){
					cdf.insertRecord({jsxid:mode[i][0], orgName:mode[i][1], jsxopen:'1'}, null, false);
/* @JSC :: begin DEBUG */
					jsx3.log('Parameter#_convertMode cdf record['+i+']:' + cdf);
/* @JSC :: end */
					for(var j = 0, _item; _item = item[j]; j++){
						cdf.insertRecord(_item, mode[i][0], false).setAttribute('jsxid',mode[i][0] + '' + j);
/* @JSC :: begin DEBUG */
						jsx3.log('Parameter#_convertMode cdf record['+j+'] child:' + cdf);
/* @JSC :: end */
					}
				}
			}catch(e){
				/* alert(e.message) */
			}
			this._mtxManage.setSourceXML(cdf);
			this._mtxManage.repaintData();
/* @JSC :: begin DEBUG */
			jsx3.log('Parameter#_convertMode cdf: ' + cdf);
/* @JSC :: end */
		};
		
		//生源地业务模式
		objRoot.prototype._loadOperationMode = function(){
			var cdf = null;
			ux.megatron.util.Dwr.callDwr("RetailStudentLoanParameterManagementUCC","getInternalOrgRetailStudentLoanModeList",[],this,
				function(data){
					if (data != null && typeof data == 'object') {
/* @JSC :: begin DEBUG */
						jsx3.log('Parameter#_loadOperationMode CDF:' + dwr.util.toDescriptiveString(data, 4));
/* @JSC :: end */
						var page = data.content.page;
						var content = data.content.data;
						var res = data.res; //code , msg, flag
						this._convertMode(content);
					}
				});
/* @JSC :: begin DEBUG */
			jsx3.log('OperationMode cdf data : ' + cdf);
/* @JSC :: end */
		};
		
		objRoot.prototype._convertParam = function(data) {
/* @JSC :: begin DEBUG */
			jsx3.log('Parameter#_convertParam CDF:' + dwr.util.toDescriptiveString(data, 4));
/* @JSC :: end */
			if(!data) 
				throw new jsx3.lang.IllegalArgumentException('parameters required!', 'data : ' + data);
			var params = [];
			try{
				for(var i = 0, item; item = data[i]; i++){
					params.push(item.paramValue);
/* @JSC :: begin DEBUG */
					jsx3.log('Parameter#_convertParam params['+i+']:' + item);
/* @JSC :: end */
				}
				var spliter = '_';
				this.selectBoxs[0].setValue(params[0].split(spliter)[0]);
				this.selectBoxs[2].setValue(params[1]);
				this.selectBoxs[3].setValue(params[2].split(spliter)[0]);
				this.selectBoxs[1].setValue(params[0].split(spliter)[1]);
				this.selectBoxs[4].setValue(params[2].split(spliter)[1]); 
			}catch(e){
				jsx3.log('Parameter#_loadParameters#_convertParam Error. data:' + dwr.util.toDescriptiveString(data, 3));
			}
		};
		
		//业务参数
		objRoot.prototype._loadParameters = function(){
			this.panelOperationMode.hide();
			this.panelParameters.show();
			//this._convertParam(['2:6','7','9:16']); //mock data
			ux.megatron.util.Dwr.callDwr("RetailStudentLoanParameterManagementUCC","getAllParameter",[],this,
				function(data){
					if (data != null && typeof data == 'object') {
/* @JSC :: begin DEBUG */
						jsx3.log('Parameter#_loadParameters CDF:' + dwr.util.toDescriptiveString(data, 4));
/* @JSC :: end */
						var page = data.content.page;
						var content = data.content.data;
						var res = data.res; //code , msg, flag
						this._convertParam(content);
					}
				});
		};
		
		//结息日
		objRoot.prototype._loadParameterA = function(){
			var cdf = ux.megatron.Main.loadXML("ux/cdb/admin/system/parameter/docs/ParameterA.xml", "ux.cdb.admin");
			this._mtxManage.setSourceXML(cdf);
			this._mtxManage.repaintData();
/* @JSC :: begin DEBUG */
			jsx3.log('ParameterA cdf data : ' + cdf);
/* @JSC :: end */
		};
		//结息周期
		objRoot.prototype._loadParameterB = function(){
			var cdf = ux.megatron.Main.loadXML("ux/cdb/admin/system/parameter/docs/ParameterB.xml", "ux.cdb.admin");
			this._mtxManage.setSourceXML(cdf);
			this._mtxManage.repaintData();
/* @JSC :: begin DEBUG */
			jsx3.log('ParameterB cdf data : ' + cdf);
/* @JSC :: end */
		};
		//固定还款日
		objRoot.prototype._loadParameterC = function(){
			var cdf = ux.megatron.Main.loadXML("ux/cdb/admin/system/parameter/docs/ParameterC.xml", "ux.cdb.admin");
			this._mtxManage.setSourceXML(cdf);
			this._mtxManage.repaintData();
/* @JSC :: begin DEBUG */
			jsx3.log('ParameterC cdf data : ' + cdf);
/* @JSC :: end */
		};
		
		/**
		* operation mode manager
		*/
		objRoot.prototype.onOperationModeSelected = function(objBtn, objEVENT, target){
			var _targetMatrix = this.getDescendantOfName(target);
/* @JSC :: begin DEBUG */
			jsx3.log("onOperationModeSelected[" + target + "] clicked.");
/* @JSC :: end */
		};
		
		objRoot.prototype.onRefreshClicked = function(objBtn, objEVENT, target){
			var _targetMatrix = this.getDescendantOfName(target);
			_targetMatrix.deselectAllRecords();
			_targetMatrix.repaintData();
/* @JSC :: begin DEBUG */
			jsx3.log("Refresh[" + target + "] clicked.");
/* @JSC :: end */
		};
		
		/**
		 * set button state,enabled or disabled
		 * @param {Object} ojbButtons <code>[[button1,true],[button2,true]...]</code>
		 */
		objRoot.prototype.setEnabledState = function(obj){
/* @JSC :: begin DEBUG */
			jsx3.log("obj[type:" + typeof(obj) + "] : " + obj.toString());
/* @JSC :: end */
			if (typeof(obj) == 'object') {
				var l = obj.length;
				for (var i = 0; i < l; i++) {
					var _obj = obj[i][0], state = obj[i][1];
/* @JSC :: begin DEBUG */
					jsx3.log("obj[" + i + "] type["+typeof(_obj)+"]:" + _obj + " state : " + state);
/* @JSC :: end */
					_obj.setEnabled((state ? jsx3.gui.Form.STATEENABLED : jsx3.gui.Form.STATEDISABLED), true);
				}
			}
		};
		
		/**
		 * Deprecated
		 * @param {Object} btnEvent
		 */
		objRoot.prototype.checkButtonEvent = function(btnEvent){
			var _returnValue = null;
			var _self = this;
			if (btnEvent == objRoot.EVENTS.CANCEL) {
				if (this.btnEvent.name == objRoot.EVENTS.NEW) {
					var _c = ux.megatron.Dialog.confirm("Confirm your control", "Do you want to drop your new records?", function(objDialog){
						_returnValue = "OK";
						objDialog.doClose();
						return (_returnValue == "OK");
						//return _whileOK.apply(_self, objDialog);
						//return _whileOK.call(_self, objDialog);
					}, null, "OK", "Cancel");
				}
			}
			var _whileOK = function(objDialog){
				alert(_returnValue + ':' + (_returnValue == "OK"));
				return (_returnValue == "OK");
			};
			alert(_returnValue);
		};

	});

}
